﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo5
{
    /// <summary>
    /// 矩形类
    /// </summary>
    public class Rectangle
    {
        private double length;//长
        private double width;//宽

        //构造方法 用于实例的初始化,对priva字段进行赋值
        public Rectangle(double length, double width)
        {
            this.length = length;
            this.width = width;
        }

        //行为 成员方法
        //面积
        public double Area()
        {
            return this.length * this.width;
        }
        //周长
        public double Perimeter()
        {
            return (length + width) * 2d;
        }
    }
}
